<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:gui="clr-namespace:DentalGUIHelper;assembly=DentalConfig">
  <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

  <!-- Stlye for all Buttons in the Toolbar of the MainWindow -->
  <!-- Style for the DefaultView-Buttons (the arrows) in the Toolbar of the MainWindow -->
  <Style x:Key="ToolBarButton" TargetType="{x:Type gui:ImageAndTextButton}">
    <Setter Property="Margin" Value="0,5"/>
    <Setter Property="FontSize" Value="{DynamicResource NormalFontSize}"/>
    <Setter Property="FontFamily" Value="{DynamicResource BoldFontFamily}"/>
    <Setter Property="FontWeight" Value="Bold"/>
    <Setter Property="TextDock" Value="Bottom"/>
    <Setter Property="Foreground" Value="{DynamicResource ToolbarButtonForegroundBrush}"/>
    <Setter Property="Background" Value="{DynamicResource SecondaryAccentBrush}"/>
    <Setter Property="Width" Value="Auto"/>
    <Setter Property="Height" Value="Auto"/>
    <Setter Property="ContentWidth" Value="38"/>
    <Setter Property="ContentHeight" Value="38"/>
    <Setter Property="Opacity" Value="0.85"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type gui:ContentAndTextButton}">
          <DockPanel Background="Transparent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
            <Viewbox
              x:Name="iconContainer"
              Margin="{TemplateBinding Padding}"
              DockPanel.Dock="Left"
              Width="{TemplateBinding ContentWidth}"
              Height="{TemplateBinding ContentHeight}"
              Visibility="{TemplateBinding ShowContent, Converter={StaticResource BooleanToVisibilityConverter}}">
              <Rectangle x:Name="rectangle" Width="38" Height="38" Fill="{TemplateBinding Foreground}">
                <Rectangle.OpacityMask>
                  <VisualBrush>
                    <VisualBrush.Visual>
                      <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </VisualBrush.Visual>
                  </VisualBrush>
                </Rectangle.OpacityMask>
              </Rectangle>
            </Viewbox>
            <!-- Text -->
            <Grid Name="textContainer" VerticalAlignment="Center" Margin="{TemplateBinding TextMargin}">
              <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
              </Grid.RowDefinitions>
              <TextBlock
                x:Name="PART_TextBlockMain"
                Text="{TemplateBinding Text}"
                Foreground="{TemplateBinding Foreground}"
                FontSize="{TemplateBinding FontSize}"
                FontFamily="{DynamicResource BoldFontFamily}"
                TextWrapping="WrapWithOverflow"
                Visibility="{TemplateBinding ShowText, Converter={StaticResource BooleanToVisibilityConverter}}"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"/>
              <TextBlock
                Grid.Row="1"
                x:Name="PART_TextBlockDescription"
                Text="{TemplateBinding Description}"
                Foreground="{DynamicResource ContentAndTextButtonDescriptionTextBrush}"
                FontSize="{DynamicResource NormalFontSize}"
                FontFamily="{DynamicResource BoldFontFamily}"
                Margin="0 2 0 0"
                TextWrapping="WrapWithOverflow"
                Visibility="{TemplateBinding ShowDescription, Converter={StaticResource BooleanToVisibilityConverter}}"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"/>
            </Grid>
          </DockPanel>
          <ControlTemplate.Triggers>
            <Trigger Property="TextDock" Value="Right">
              <Setter TargetName="iconContainer" Property="DockPanel.Dock" Value="Left"/>
              <Setter TargetName="textContainer" Property="HorizontalAlignment" Value="Left"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Left">
              <Setter TargetName="iconContainer" Property="DockPanel.Dock" Value="Right"/>
              <Setter TargetName="textContainer" Property="HorizontalAlignment" Value="Right"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Top">
              <Setter TargetName="iconContainer" Property="DockPanel.Dock" Value="Bottom"/>
              <Setter TargetName="textContainer" Property="HorizontalAlignment" Value="Center"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Bottom">
              <Setter TargetName="iconContainer" Property="DockPanel.Dock" Value="Top"/>
              <Setter TargetName="textContainer" Property="HorizontalAlignment" Value="Center"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Opacity" Value="1"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="Foreground" Value="{Binding Path=Background, RelativeSource={RelativeSource Self}}"/>
              <Setter Property="Opacity" Value="1"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" Value="{DynamicResource DisabledOpacity}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ToolBarToggleButton" TargetType="{x:Type gui:ImageAndTextToggleButton}">
    <Setter Property="Margin" Value="0,5"/>
    <Setter Property="FontSize" Value="{DynamicResource NormalFontSize}"/>
    <Setter Property="FontFamily" Value="{DynamicResource BoldFontFamily}"/>
    <Setter Property="FontWeight" Value="Bold"/>
    <Setter Property="TextDock" Value="Bottom"/>
    <Setter Property="Foreground" Value="{DynamicResource ToolbarButtonForegroundBrush}"/>
    <Setter Property="Background" Value="{DynamicResource SecondaryAccentBrush}"/>
    <Setter Property="Width" Value="Auto"/>
    <Setter Property="Height" Value="Auto"/>
    <Setter Property="ContentWidth" Value="38"/>
    <Setter Property="ContentHeight" Value="38"/>
    <Setter Property="Opacity" Value="0.85"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type gui:ImageAndTextToggleButton}">
          <DockPanel Background="Transparent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
            <Viewbox
              x:Name="iconContainer"
              Margin="{TemplateBinding Padding}"
              DockPanel.Dock="Top"
              Width="{TemplateBinding ContentWidth}"
              Height="{TemplateBinding ContentHeight}"
              Visibility="{TemplateBinding ShowContent, Converter={StaticResource BooleanToVisibilityConverter}}">
              <Rectangle x:Name="rectangle" Width="38" Height="38" Fill="{TemplateBinding Foreground}">
                <Rectangle.OpacityMask>
                  <VisualBrush>
                    <VisualBrush.Visual>
                      <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </VisualBrush.Visual>
                  </VisualBrush>
                </Rectangle.OpacityMask>
              </Rectangle>
            </Viewbox>
            <!-- Text -->
            <Grid Name="textContainer" VerticalAlignment="Center" Margin="{TemplateBinding TextMargin}">
              <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
              </Grid.RowDefinitions>
              <!-- Text -->
              <TextBlock
                x:Name="PART_TextBlock"
                Text="{TemplateBinding Text}"
                Foreground="{TemplateBinding Foreground}"
                Margin="{TemplateBinding TextMargin}"
                TextWrapping="WrapWithOverflow"
                Visibility="{TemplateBinding ShowText, Converter={StaticResource BooleanToVisibilityConverter}}"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"/>
            </Grid>
          </DockPanel>
          <ControlTemplate.Triggers>
            <Trigger Property="TextDock" Value="Right">
              <Setter TargetName="iconContainer" Property="DockPanel.Dock" Value="Left"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Left">
              <Setter TargetName="iconContainer" Property="DockPanel.Dock" Value="Right"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Top">
              <Setter TargetName="iconContainer" Property="DockPanel.Dock" Value="Bottom"/>
            </Trigger>
            <Trigger Property="TextDock" Value="Bottom">
              <Setter TargetName="iconContainer" Property="DockPanel.Dock" Value="Top"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Opacity" Value="1"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="Foreground" Value="{Binding Path=Background, RelativeSource={RelativeSource Self}}"/>
              <Setter Property="Opacity" Value="1"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
              <Setter Property="Foreground" Value="{Binding Path=Background, RelativeSource={RelativeSource Self}}"/>
              <Setter Property="Opacity" Value="1"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" Value="{DynamicResource DisabledOpacity}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>
